<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
    <link rel="stylesheet" href="../../plugins/layui/css/layui.css">
</head>

<body>
    <div class="layui-row">
        <div class="layui-col-xs4 layui-col-sm12 layui-col-md4">
            <div class="grid-demo layui-bg-gray" style="height:30px;text-align: center;">患者姓名</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm7 layui-col-md4">
            <div class="grid-demo layui-bg-gray" style="height:30px;text-align: center">患者年龄</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm5 layui-col-md4">
            <div class="grid-demo layui-bg-gray" style="height:30px;text-align: center">联系方式</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm12 layui-col-md4">
            <div class="grid-demo layui-bg-blue" style="height:30px;text-align: center;" id="name"></div>
        </div>
        <div class="layui-col-xs4 layui-col-sm7 layui-col-md8">
            <div class="grid-demo layui-bg-green" style="height:30px;text-align: center" id="age"></div>
        </div>
        <div class="layui-col-xs4 layui-col-sm5 layui-col-md4">
            <div class="grid-demo layui-bg-black" style="height:30px;text-align: center" id="phone"></div>
        </div>
        <div class="layui-col-xs4 layui-col-sm12 layui-col-md4">
            <div class="grid-demo layui-bg-gray" style="height:30px;text-align: center;">医生姓名</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm7 layui-col-md8">
            <div class="grid-demo layui-bg-gray" style="height:30px;text-align: center">科室</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm5 layui-col-md4">
            <div class="grid-demo layui-bg-gray" style="height:30px;text-align: center">是否住院</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm12 layui-col-md4">
            <div class="grid-demo layui-bg-blue" style="height:30px;text-align: center;">患者姓名</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm7 layui-col-md8">
            <div class="grid-demo layui-bg-green" style="height:30px;text-align: center">患者年龄</div>
        </div>
        <div class="layui-col-xs4 layui-col-sm5 layui-col-md4">
            <div class="grid-demo layui-bg-black" style="height:30px;text-align: center">联系方式</div>
        </div>
        <div class="layui-col-xs12 ">
            <div class="layui-bg-red" style="height:200px;text-align: center">
                <label class="layui-form-label">病历信息</label>

                <!-- 提交表单 -->
                <form class="layui-form" >

                    <div class="layui-form-item layui-form-text">

                        <div class="layui-input-block" style="margin-left: 0px">
                            <textarea placeholder="请输入内容" class="layui-textarea" style="height: 240px"></textarea>
                        </div>
                    </div>
                    <div class="layui-form-item">
                        <div class="layui-input-block">
                            <button type="submit" class="layui-btn" lay-submit="" lay-filter="demo1">立即提交</button>
                            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
                        </div>
                    </div>
                </form>

            </div>
        </div>
    </div>
    <script src="../../plugins/jquery/jquery.min.js"></script>
    <script src="../../plugins/layui/layui.all.js"></script>
    <script>

        $(function () {

            var url = location.search;

            var obj = {};
            var reg = /\?/;
            if (url.match(reg)) {
                //判断传入参数，以问号截取，问号后是参数
                var chars = url.split('?')[1];

                //再截&号
                var arr = chars.split('&');

                //获得截取后的数组为键值对字符串
                for (var i = 0; i < arr.length; i++) {

                    //保守一点确定看是否为 name=value形式
                    var num = arr[i].indexOf("=");

                    if (num > 0) {
                        //拼接字符串
                        var name = arr[i].substring(0, num);
                        var value = arr[i].substr(num + 1);

                        //拼接对象，并转码
                        obj[decodeURIComponent(name)] = decodeURIComponent(value);
                    }
                }
            }

            console.log(obj)

            var nameText = document.getElementById("name").innerHTML=obj.name
            var ageText = document.getElementById("age").innerHTML=obj.age
            var phoneText = document.getElementById("phone").innerHTML=obj.phone


        })


    </script>
</body>

</html>